home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / kartsfloatwatch.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.4 KB  |  83 lines

  1.     /*
  2.  
  3.     Copyright (C) 2001 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.   
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20.  
  21.     */
  22.  
  23. #include "common.h"
  24. #include <qobject.h>
  25.  
  26. class KArtsFloatWatchPrivate;
  27. namespace Arts { class KFloatWatchProxy_impl; }
  28.  
  29. /**
  30.  * KArtsFloatWatch offers an easy way to watch aRts streams via Qt signals.
  31.  * For instance, if you have an object of the following type:
  32.  *
  33.  * \code
  34.  * interface StereoVolumeControl : StereoEffect {
  35.  *   attribute float scaleFactor;
  36.  *   readonly attribute float currentVolumeLeft;
  37.  *   readonly attribute float currentVolumeRight;
  38.  * };
  39.  * \endcode
  40.  *
  41.  * and you want to get notified when scaleFactor changes, you could do it
  42.  * like this:
  43.  *
  44.  * \code
  45.  *   StereoVolumeControl stereoVolumeControl = ...;
  46.  *   KArtsFloatWatch *w = new KArtsFloatWatch(stereoVolumeControl, "scaleFactor_changed", this);
  47.  *   connect(w, SIGNAL(valueChanged(float)), this, SLOT(setValue(float)));
  48.  * \endcode
  49.  */
  50. class KArtsFloatWatch : public QObject {
  51.     Q_OBJECT
  52. private:
  53.     KArtsFloatWatchPrivate *d;
  54.     friend class Arts::KFloatWatchProxy_impl;
  55.  
  56.     /**
  57.      * called by the proxy (internal)
  58.      */
  59.     void change(float newValue);
  60.  
  61. public:
  62.     /**
  63.      * Constructor.
  64.      *
  65.      * @param object  the aRts object that should be watched
  66.      * @param stream  the aRts stream that should be watched
  67.      * @param parent  the parent Qt object
  68.      * @param name    the Qt object name of this object
  69.      */
  70.     KArtsFloatWatch(Arts::Object object, const char *stream, QObject *parent = 0, const char *name = 0);
  71.  
  72.     /**
  73.      * Destructor
  74.      */
  75.     ~KArtsFloatWatch();
  76.  
  77. signals:
  78.     /**
  79.      * this signal will be emitted with values of the aRts stream
  80.      */
  81.     void valueChanged(float newValue);
  82. };
  83.